package cn.dzhy.myzf.qq.email.model;

import cn.dzhy.myzf.qq.email.type.Gender;
import com.alibaba.fastjson.annotation.JSONField;


import java.io.Serializable;
import java.util.List;

public class User implements Serializable {



    /**
     *必填	成员UserID。企业邮帐号名，邮箱格式
     * */
    @JSONField(name = "userid")
    private String userId;
    /**
     *必填	成员名称。长度为1~64个字节
     * */
    private String name;
    /**
     *必填	成员所属部门id列表，不超过20个
     * */
    @JSONField(name = "department")
    private List<Long> partyIds;
    /**
     *非必填	职位信息。长度为0~64个字节
     * */
    private String position;
    /**
     *非必填	手机号码
     * */
    private String mobile;
    /**
     *非必填	座机号码
     * */
    private String tel;
    /**
     *非必填	编号
     * */
    private String extid;
    /**
     *非必填	性别。1表示男性，2表示女性
     * */
    private Integer gender;
    /**
     *非必填	别名列表
     1.Slaves 上限为5个
     2.Slaves 为邮箱格式
     * */
    private List<String> slaves;
    /**
     * 必填	密码
     * */
    private String password;

    /**
     *  非必填 用户重新登录时必填非必填重设密码, 登陆重设密码后，该标志位还原。0表示非必填，1表示必填，缺省为0
     */

    private Integer cpwd_login;



    protected User() {
    }


    public User(String name,String userId, String password,List<Long> partyIds,Boolean cpwd_login) {
        this.name = name;
        this.userId = userId;
        this.password= password;
        this.partyIds = partyIds;
        this.cpwd_login = cpwd_login ? 1:0;;
    }

    @JSONField(serialize = false)
    public Gender getFormatGender() {
        if (gender != null) {
            if (gender.intValue() == 1) {
                return Gender.male;
            } else if (gender.intValue() == 2) {
                return Gender.female;
            } else {
                return Gender.unknown;
            }
        }
        return null;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Long> getPartyIds() {
        return partyIds;
    }

    public void setPartyIds(List<Long> partyIds) {
        this.partyIds = partyIds;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getExtid() {
        return extid;
    }

    public void setExtid(String extid) {
        this.extid = extid;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public List<String> getSlaves() {
        return slaves;
    }

    public void setSlaves(List<String> slaves) {
        this.slaves = slaves;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getCpwd_login() {
        return cpwd_login;
    }

    public void setCpwd_login(Boolean cpwd_login) {
        this.cpwd_login = cpwd_login ? 1:0;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId='" + userId + '\'' +
                ", name='" + name + '\'' +
                ", partyIds=" + partyIds +
                ", position='" + position + '\'' +
                ", mobile='" + mobile + '\'' +
                ", tel='" + tel + '\'' +
                ", extid='" + extid + '\'' +
                ", gender=" + gender +
                ", slaves=" + slaves +
                ", password='" + password + '\'' +
                ", cpwd_login=" + cpwd_login +
                '}';
    }
}
